import 'dart:ui';

import 'package:flutter_yn_goods/utils/log/utils_log.dart';
import 'package:flutter_yn_goods/utils/shared/shared_export.dart';
import 'package:get/get.dart';

class UtilsOther {
  static int getPrivacyId() {
    // Get.curr

    Locale? currentLocale = SharedStorage().initialLocale() ?? Get.deviceLocale;
clog('currentLocale?.languageCode   ${currentLocale?.languageCode}');
    if (currentLocale?.languageCode == 'zh') {
      return 0;
    } else if (currentLocale?.languageCode == 'vi') {
      return 200;
    }
    return 100;
    //   Locale('en', 'US'),
    // Locale('zh', 'CN'),
    // Locale('vi', 'VN'),
    // Locale('ar', 'SA'), // 添加阿拉伯语
  }
static String getGoodsPrice(dynamic price) {
  // 转换为数字
  double numPrice = price is String ? double.tryParse(price) ?? 0 : (price ?? 0).toDouble();


  // 移除小数部分如果是.00
  int intPrice = numPrice.toInt();
  String priceStr = (numPrice == intPrice) ? intPrice.toString() : numPrice.toString();
  
  // 添加千位分隔点
  final RegExp reg = RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))');
  priceStr = priceStr.replaceAllMapped(reg, (Match match) => '${match[1]}.');
  
  return "₫$priceStr";
}


}
